x86: Meltdown band-aid against malicious 64-bit PV guests
authorJan Beulich <jbeulich@suse.com>
Tue, 16 Jan 2018 16:49:03 +0000 (17:49 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 16 Jan 2018 16:49:03 +0000 (17:49 +0100)
commit5784de3e2067ed73efc2fe42e62831e8ae7f46c4
treea481bbda5001b5cdfa26e004324bb53098fc175c
parentbd61fe94bee0556bc2f64999a4a8315b93f90f21
x86: Meltdown band-aid against malicious 64-bit PV guests

This is a very simplistic change limiting the amount of memory a running
64-bit PV guest has mapped (and hence available for attacking): Only the
mappings of stack, IDT, and TSS are being cloned from the direct map
into per-CPU page tables. Guest controlled parts of the page tables are
being copied into those per-CPU page tables upon entry into the guest.
Cross-vCPU synchronization of top level page table entry changes is
being effected by forcing other active vCPU-s of the guest into the
hypervisor.

The change to context_switch() isn't strictly necessary, but there's no
reason to keep switching page tables once a PV guest is being scheduled
out.

This isn't providing full isolation yet, but it should be covering all
pieces of information exposure of which would otherwise require an XSA.

There is certainly much room for improvement, especially of performance,
here - first and foremost suppressing all the negative effects on AMD
systems. But in the interest of backportability (including to really old
hypervisors, which may not even have alternative patching) any such is
being left out here.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/domain.c
xen/arch/x86/mm.c
xen/arch/x86/smpboot.c
xen/arch/x86/x86_64/asm-offsets.c
xen/arch/x86/x86_64/compat/entry.S
xen/arch/x86/x86_64/entry.S
xen/include/asm-x86/asm_defns.h
xen/include/asm-x86/current.h
xen/include/asm-x86/processor.h
xen/include/asm-x86/x86_64/page.h